Node (from EventEmitter)

The base node which everything inherits from.

Options

  • screen - The screen to be associated with.
  • parent - The desired parent.
  • children - An arrray of children.

Properties

  • Inherits all from EventEmitter.
  • type - Type of the node (e.g. box).
  • options - Original options object.
  • parent - Parent node.
  • screen - Parent screen.
  • children - Array of node's children.
  • data, _, $ - An object for any miscellanous user data.
  • index - Render index (document order index) of the last render call.

Events

  • Inherits all from EventEmitter.
  • adopt - Received when node is added to a parent.
  • remove - Received when node is removed from it's current parent.
  • reparent - Received when node gains a new parent.
  • attach - Received when node is attached to the screen directly or somewhere in its ancestry.
  • detach - Received when node is detached from the screen directly or somewhere in its ancestry.

Methods

  • Inherits all from EventEmitter.
  • prepend(node) - Prepend a node to this node's children.
  • append(node) - Append a node to this node's children.
  • remove(node) - Remove child node from node.
  • insert(node, i) - Insert a node to this node's children at index i.
  • insertBefore(node, refNode) - Insert a node to this node's children before the reference node.
  • insertAfter(node, refNode) - Insert a node from node after the reference node.
  • detach() - Remove node from its parent.
  • emitDescendants(type, args..., [iterator]) - Emit event for element, and recursively emit same event for all descendants.
  • get(name, [default]) - Get user property with a potential default value.
  • set(name, value) - Set user property to value.

Last update: February 22, 2020